﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Data.Common;

namespace SimpleQueryTool.Library.Business
{
	public class DbProviderManager
	{
		public List<DbProvider> GetAllDbProviders()
		{
			var dbProviders = new List<DbProvider>();

			var factoryClasses = DbProviderFactories.GetFactoryClasses();
			foreach (DataRow row in factoryClasses.Rows)
			{
				var dbProvider = new DbProvider();

				dbProvider.Name = (string) row["Name"];
				dbProvider.ProviderName = (string) row["InvariantName"];
				
				dbProviders.Add(dbProvider);
			}

			return dbProviders;
		}
	}
}
